package comm_serv

import (
	"ubt-rbac-service/internal/app/model"
	"ubt-rbac-service/internal/app/util"
)

type commServ struct{}

var CommServ = commServ{}

// Areas 下拉选择省市区乡镇
func (s *commServ) Areas(pid string) *model.Result {
	sqlStr := "SELECT area_id sel_id, area_name sel_name, area_id sel_code, false chked FROM sys_area WHERE parent_id=$1 ORDER BY area_id"
	if dbMap, err := util.GetAll(sqlStr, pid); err == nil && len(dbMap) > 0 {
		return &model.Result{RetCode: 1001, RetMsg: "ok", RetData: dbMap}
	} else {
		return &model.Result{RetCode: 1000, RetMsg: "暂无内容"}
	}
}
